package pit.com.ordermobile.expanable;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class ExpandAdapter {
	
	ExpandGroup gr= new ExpandGroup();
	@SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
	public  List createGroupList() {
	  ArrayList result = new ArrayList();
	  for( int i = 0 ; i < gr.groupname.length ; ++i ) {
		HashMap m = new HashMap();
	    m.put( "groupName",gr.groupname[i] );
		result.add( m );
	  }
	  return (List)result;
    }
	
	ExpandChild cr = new ExpandChild();
	  @SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
	  public List createChildList() {
	  	ArrayList result = new ArrayList();
	  	for( int i = 0 ; i < cr.childname.length ; ++i ) {
	  // Second-level lists
	  	  ArrayList secList = new ArrayList();
	  	  for( int n = 0 ; n < cr.childname[i].length ; n += 2 ) {
	  	    HashMap child = new HashMap();
	  		child.put( "childName", cr.childname[i][n] );
	  	    child.put( "crn", cr.childname[i][n+1] );
	  		secList.add( child );
	  	  }
	  	  result.add( secList );
	  	}
	  	return result;
	    }

}
